import sqlite3

conn = sqlite3.connect('mydb.db')       #创建数据库
conn.text_factory = str                 #Python和SQLite类型转换不统一，将数据库连接的text_factory属性设置为str
c = conn.cursor()                       #连接数据库

c.execute('''DROP TABLE IF EXISTS users''')
c.execute('''CREATE TABLE users (
  id integer primary key autoincrement,
  name text not null,
  password text not null)''')

c.execute('''insert into users (name, password) values ('visit', '111')''')
c.execute('''insert into users (name, password) values ('admin', '123')''')

conn.commit()
conn.close()
